 <h1 class="page-header">操作</h1>
<ol class="breadcrumb">
  <li><a data-toggle="modal" data-target="#addUser">增加用户</a></li>
</ol>
<h1 class="page-header">管理 <span class="badge">2</span></h1>
<div class="table-responsive">
  <table class="table table-striped table-hover">
    <thead>
      <tr>
        <th><span class="glyphicon glyphicon-th-large"></span> <span class="visible-lg">选择</span></th>
        <th><span class="th-large"></span> <span class="visible-lg">用户id</span></th>
        <th><span class="user"></span> <span class="visible-lg">用户名</span></th>
        <th><span class="bookmark"></span> <span class="visible-lg">密码</span></th>
        <th><span class="pushpin"></span> <span class="visible-lg">手机</span></th>
        <th><span class="time"></span> <span class="visible-lg">userid</span></th>
        <th><span class="pencil"></span> <span class="visible-lg">操作</span></th>
      </tr>
    </thead>
    <tbody>
      <%for(var i = 0;i<data.length;i++){%>

      <tr>
       <td><input type="checkbox" class="input-control" name="checkbox[]" value="<%=data[i].id%>" /></td>
        <td class="article-title"><%=data[i].id %></td>
        <td><%=data[i].username %></td>
        <td class="hidden-sm"><%=data[i].password %></td>
        <td class="hidden-sm"><%=data[i].phone%></td>
        <td><%=data[i].userid%></td>
       <td><a data-toggle="modal" data-target="#seeUserInfo">修改</a> <a rel="<%=data[i].id %>">删除</a></td>
      </tr>
      <% }%>
    </tbody>
  </table>
</div>
   <footer class="message_footer">
    <nav>
      <div class="btn-toolbar operation" role="toolbar">
        <div class="btn-group" role="group"> <a class="btn btn-default" onClick="select()">全选</a> <a class="btn btn-default" onClick="reverse()">反选</a> <a class="btn btn-default" onClick="noselect()">不选</a> </div>
        <div class="btn-group" role="group">
          <button type="submit" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="删除全部选中" name="checkbox_delete">删除</button>
        </div>
   <footer />
<script>
//是否确认删除
$(function(){   
  $("#main table tbody tr td a").click(function(){
    var name = $(this);
    var id = name.attr("rel"); //对应id  
    if (event.srcElement.outerText === "删除") 
    {
      if(window.confirm("此操作不可逆，是否确认？"))
      {
        $.ajax({
          type: "get",
          url: "/user/del/"+id,
          data: {id:id},
          cache: false, //不缓存此页面   
          success: function (data) {
            window.location.reload();
          }
        });
      };
    };
  });   
});
</script>
<!--增加用户模态框-->
<div class="modal fade" id="addUser" tabindex="-1" role="dialog" aria-labelledby="addUserModalLabel">
  <div class="modal-dialog" role="document" style="max-width:450px;">
    <form action="/user/add" method="post" autocomplete="off" draggable="false">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" >增加用户</h4>
        </div>
        <div class="modal-body">
          <table class="table" style="margin-bottom:0px;">
            <thead>
              <tr> </tr>
            </thead>
            <tbody>
              <tr>
                <td wdith="20%">姓名:</td>
                <td width="80%"><input type="text" value="" class="form-control" name="truename" maxlength="10" autocomplete="off" /></td>
              </tr>
              <tr>
                <td wdith="20%">用户名:</td>
                <td width="80%"><input type="text" value="" class="form-control" name="username" maxlength="10" autocomplete="off" /></td>
              </tr>
              <tr>
                <td wdith="20%">电话:</td>
                <td width="80%"><input type="text" value="" class="form-control" name="phone" maxlength="13" autocomplete="off" /></td>
              </tr>
              <tr>
                <td wdith="20%">新密码:</td>
                <td width="80%"><input type="password" class="form-control" name="password" maxlength="18" autocomplete="off" /></td>
              </tr>
              <tr>
                <td wdith="20%">确认密码:</td>
                <td width="80%"><input type="password" class="form-control" name="new_password" maxlength="18" autocomplete="off" /></td>
              </tr>
            </tbody>
            <tfoot>
              <tr></tr>
            </tfoot>
          </table>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="submit" class="btn btn-primary">提交</button>
        </div>
      </div>
    </form>
  </div>
</div>

